<template>
  <div class="newMusic">
    <h3>
      <router-link to="/home/newmusic">{{title}}<i class="iconfont icon-youjiantou
"></i></router-link>
    </h3>
    <div class="kind-music">
      <ul>
        <li v-for="item in musicData" :key="item.id" @click="playMusic(item)">
          <img :src="item.picUrl" alt="">
          <div class="dec-title">
            <p>{{item.name}}</p>
            <span>{{item.song.artists[0].name}}</span>
          </div>
          <i class="iconfont icon-sanjiaoright"></i>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: 'NewMusic',
  props: {
    title: String,
    musicData: {
      type: Array,
      default() {
        return []
      }
    }
  }
}
</script>

<style lang="less" scoped>
.newMusic {
  h3 {
    a {
      display: flex;
      align-items: center;
      margin-left: 20px;
    }
  }
  .kind-music {
    ul {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      li {
        position: relative;
        display: flex;
        width: 30%;
        margin: 10px 30px 20px 10px;
        &:hover .icon-sanjiaoright {
          display: block;
        }
        img {
          width: 100px;
          height: 100px;
          margin-right: 15px;
          border-radius: 8px;
        }
        .dec-title {
          display: flex;
          flex-direction: column;
          justify-content: center;
          font-size: 14px;
          p {
            margin: 0;
          }
          span {
            margin-top: 15px;
            color: #666;
          }
        }
        .icon-sanjiaoright {
          display: none;
          position: absolute;
          top: 40px;
          left: 40px;
          z-index: 10;
          color: red;
          width: 20px;
          height: 20px;
          background: rgba(0, 0, 0, 0.4);
          border-radius: 50%;
          &::before {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
          }
        }
      }
    }
  }
}
</style>